﻿using DropBoxClient.Entities;
using DropBoxClient.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DropBoxClient.Operations
{
    class GetFileMetaOperation
    {
        private static readonly string Url = "https://api.dropbox.com/1/metadata/{0}/{1}";
        private static readonly string MethodType = StringConstants.GetMethodType;

        private WebOperation<FileMeta> _operation;
        private string _accessToken;

        internal string Root { get; set; }
        internal string Path { get; set; }

        internal GetFileMetaOperation(string accessToken)
        {
            _accessToken = accessToken;
        }

        internal FileMeta Execute()
        {
            string url = string.Format(Url, Root, Path);
            _operation = new WebOperation<FileMeta>(url, _accessToken, MethodType);
            return _operation.Execute();
        }
    }
}
